package a1_4;

/**
 * 现金支付（Payment子类）
 */
public class Cash extends Payment {
    private double cashTendered; // 支付金额（实际支付的现金）

    public Cash() {}

    public Cash(double amount, double cashTendered) {
        super(amount);
        this.cashTendered = cashTendered;
    }

    // 实现父类抽象方法：验证现金有效性（支付金额≥应付金额）
    @Override
    public boolean validatePayment() {
        return cashTendered >= amount;
    }

    // Getter/Setter
    public double getCashTendered() {
        return cashTendered;
    }

    public void setCashTendered(double cashTendered) {
        this.cashTendered = cashTendered;
    }
}